<?php

// [ 会员信息 ]

namespace app\common\validate;
use think\Validate;

class MemberInfo extends Validate
{
    // 验证规则
    protected $rule = [
        'nickname'   => 'max:40',
        'headimgurl' => 'max:256',
        'company'    => 'max:40',
        'position'   => 'max:20',
        'mobile'     => 'regex:^1[34578]{1}\d{9}$',
        'wechat'     => 'length:2,18',
        'email'      => 'email',
        'province'   => 'max:20',
        'city'       => 'max:20',
    ];

    // 错误提示
    protected $message = [
        'nickname.max'      => '昵称最大长度[40]',
        
        'headimgurl.max'    => '头像URI最大长度[256]',

        'company.max'       => '公司名称最大长度[40]',
        
        'position.max'      => '职位最大长度[20]',
        
        'mobile.regex'      => '手机号格式不正确',
        
        'wechat.length'     => '微信号长度[2~18]',
        
        'email.email'       => '邮箱格式不正确',
        
        'province.max'      => '省最大长度[20]',
        'city.max'          => '市最大长度[20]',
    ];
    
    // 验证场景
    protected $scene = [
        // 完善个人信息
        'complete' => ['nickname','headimgurl','company','position','wechat','email','province','city'],
    ];
}